package com.waitingresult.bzzc.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.waitingresult.bzzc.entity.Partners;
import com.waitingresult.bzzc.mapper.PartnersMapper;
import com.waitingresult.bzzc.qo.PartnersQo;
import com.waitingresult.bzzc.service.PartnersService;
import com.waitingresult.common.base.service.impl.AbstractBaseServiceImpl;
import org.springframework.stereotype.Service;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : PartnersServiceImpl
 * @Description :
 * @date : 2021/11/28 1:11
 */
@Service
public class PartnersServiceImpl extends AbstractBaseServiceImpl<PartnersMapper, Partners, PartnersQo> implements PartnersService {

    @Override
    public LambdaQueryWrapper<Partners> getLamdaQueryWrapper(PartnersQo qo) {
        return new LambdaQueryWrapper<Partners>()
                .eq(ObjectUtil.isNotNull(qo.getId()), Partners::getId, qo.getId())
                .eq(ObjectUtil.isNotNull(qo.getType()), Partners::getType, qo.getType())
                .like(ObjectUtil.isNotNull(qo.getCompanyName()), Partners::getCompanyName, qo.getCompanyName())
                .like(ObjectUtil.isNotNull(qo.getContactName()), Partners::getContactName, qo.getContactName())
                .like(ObjectUtil.isNotNull(qo.getContactPhone()), Partners::getContactPhone, qo.getContactPhone());
    }
}
